﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using OAProject.Domain.Entities;
using OAProject.Domain.Interfaces;
using Microsoft.AspNetCore.Authorization;

namespace OAProject.API.Controllers
{
    [Route("api/[controller]/[Action]")]
    [ApiController]
    [Authorize]     //全局授权过滤器
    public class TodoitemApiController : ControllerBase
    {
        //依赖注入
        private IserverRepository _repository;
        public TodoitemApiController(IserverRepository repository)
        {
            _repository = repository;
        }

        
        //[HttpGet]
        //public IActionResult GetIndex(string name="",int page=1,int limit=10)
        //{
        //    List<Users> list = _repository.Show().Where(x=>x.Name.Contains(name)).ToList();
        //    var _list = list.Skip((page - 1) * limit).Take(limit).ToList();
        //    return Ok(new { 
        //        data=_list,
        //        code=0,
        //        msg="",
        //        count=list.Count
        //    });
        //}

        
        //[HttpPost]
        //public IActionResult Add([FromForm]Users obj)   //[FromForm]是接受页面传过来的数据
        //{
        //    int a = _repository.Insert(obj);
        //    return Ok(a);
        //}
    }
}
